package com.meiyou.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.meiyou.mapper.MeiyouLyaskMapper;
import com.meiyou.mapper.MeiyouTourMapper;
import com.meiyou.mapper.UserMapperCustom;
import com.meiyou.pojo.EasyUIDataGrid;
import com.meiyou.pojo.MeiyouLyask;
import com.meiyou.pojo.MeiyouTour;
import com.meiyou.pojo.MeiyouTourExample;
import com.meiyou.pojo.TourDetails;
import com.meiyou.pojo.vo.TourApplyVo;
import com.meiyou.pojo.vo.TourVo;
import com.meiyou.service.TourService;

@Service
public class TourServiceImpl implements TourService {
	@Resource
	private MeiyouTourMapper meiyouTourMapper;
	@Resource
	private UserMapperCustom userMapperCustom;
	@Resource
	private MeiyouLyaskMapper meiyouLyaskMapper;

	
	public int insTour(MeiyouTour meiyouTour) {
		return meiyouTourMapper.insert(meiyouTour);
	}

	
	public List<TourVo> selTourVo(String tUcount) {
		return meiyouTourMapper.selTourVo(tUcount);
	}

	
	public List<TourVo> selMyTour(String uCount) {
		return meiyouTourMapper.selMyTour(uCount);
	}

	
	public int delMyTour(int tId) {
		MeiyouTourExample example = new MeiyouTourExample();
		example.createCriteria().andTIdEqualTo(tId);
		return meiyouTourMapper.deleteByPrimaryKey(tId);
	}

	
	public List<MeiyouTour> showTour(MeiyouTour meiyouTour) {
		return meiyouTourMapper.selectTour(meiyouTour);
	}

	
	public EasyUIDataGrid selAllTour(String tUCount, int rows, int page) {
		PageHelper.startPage(page, rows);
		List<MeiyouTour> list = meiyouTourMapper.selAllTour(tUCount);
		PageInfo<MeiyouTour> pi = new PageInfo<MeiyouTour>(list);
		EasyUIDataGrid dataGrid = new EasyUIDataGrid();
		dataGrid.setRows(pi.getList());
		dataGrid.setTotal(pi.getTotal());
		return dataGrid;
	}

	
	public MeiyouTour selTourById(int tId) {
		return meiyouTourMapper.selTourById(tId);
	}

	
	public List<TourVo> selTourVoTerm(String tUcount,String sex) {
		return meiyouTourMapper.selTourVoTerm(tUcount,sex);
	}

	
	public List<TourDetails> selTourDetails(int tId) {
		return meiyouTourMapper.selTourDetails(tId);
	}

	
	public int insLyask(MeiyouLyask meiyouLyask) {
		return meiyouLyaskMapper.insert(meiyouLyask);
	}

	
	public  int selCount(int id) {
		return meiyouLyaskMapper.selCount(id);
	}

	
	public List<TourVo> selLyask(int tId) {
		return meiyouTourMapper.selLyask(tId);
	}

	
	public int updState(int id) {
		return meiyouLyaskMapper.updState(id);
	}

	
	public int delLyask(int lId) {
		return meiyouLyaskMapper.deleteByPrimaryKey(lId);
	}

	
	public int updAssess(int tAssess, int tId) {
		return meiyouTourMapper.updAssess(tAssess, tId);
	}

	
	public List<TourApplyVo> selMyTourApply(String uCount) {
		return meiyouTourMapper.selMyTourApply(uCount);
	}

	
	public int selTourAssess(int tId) {
		return meiyouTourMapper.selTourAssess(tId);
	}

}
